package parser

import (
	"goruntimeCrawler/engine"
	"regexp"
)

var rex=regexp.MustCompile(`(http://m.zhenai.com/u/[^"]*)"`)
//<a href="http://album.zhenai.com/u/1368724723" target="_blank">*</a>
var page=regexp.MustCompile(`(http://m.zhenai.com/zhenghun/[^"]*)"`)

func ParserProfilList(contens []byte) engine.ParseResult{

    match:=rex.FindAllSubmatch(contens,-1)
	result:=engine.ParseResult{}
	for _,m:=range match{
		url:=m[1]
		result.Requests=append(result.Requests,engine.Request{
			UrL:string(url),
			ParserFunc: func(bytes []byte) engine.ParseResult {
				 return ParsePorfile(bytes,string(url))
			},
		})
		//result.Items=append(result.Items,nil)
	}
	pageUrl:=page.FindSubmatch(contens)
	if len(pageUrl) >0 {
		result.Requests=append(result.Requests,engine.Request{
			UrL:string(pageUrl[1]),
			ParserFunc:ParserProfilList,
		})
	}
	return result
}

